//
//  KABadgeCollectionHeaderView.m
//  KeepAccount
//
//  Created by Veer on 2017/12/26.
//  Copyright © 2017年 Veer. All rights reserved.
//

#import "KABadgeCollectionHeaderView.h"

#import "KABadgeSectionModel.h"

@interface KABadgeCollectionHeaderView()

@property (nonatomic, weak) UILabel *nameLbl;
@property (nonatomic, weak) UILabel *badgeCountLbl;

@end

@implementation KABadgeCollectionHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self setupSubView];
    }
    return self;
}

- (void)setupSubView
{
    
    UILabel *nameLbl = [[UILabel alloc] init];
    nameLbl.textColor = RGB(51, 51, 51);
    nameLbl.font = VRFont(16);
    [self addSubview:nameLbl];
    self.nameLbl = nameLbl;
    [nameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.centerY.mas_equalTo(self);
    }];
    
    UILabel *badgeCountLbl = [[UILabel alloc] init];
    badgeCountLbl.textColor = RGB(150, 150, 150);
    badgeCountLbl.font = VRFont(12);
    [self addSubview:badgeCountLbl];
    self.badgeCountLbl = badgeCountLbl;
    [badgeCountLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(nameLbl.mas_right).offset(10);
        make.centerY.mas_equalTo(self);
    }];
}


#pragma mark - setter && getter
- (void)setSectionModel:(KABadgeSectionModel *)sectionModel
{
    _sectionModel = sectionModel;
    
    self.nameLbl.text = sectionModel.name;
    self.badgeCountLbl.text = [NSString stringWithFormat:@"已获取%ld枚", (long)sectionModel.hadCount];
}

@end
